package com.ysynzehao.dao;

import com.ysynzehao.bean.OrderAchievement;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;

import java.util.List;

/**
 * niuzehao
 * 2019/1/7 17:42.
 */
public interface OrderAchievementDao extends MongoRepository<OrderAchievement, String> {

    List<OrderAchievement> findByOrderUidAndGoodsNum(String orderUid, Integer goodsNum);

    @Query(sort = "{achievement: -1}")
    List<OrderAchievement> findByUsersRegex(String users);

    @Query(count = true)
    List<OrderAchievement> findByUsersRegexAndAchievement(String users, Double achievement);
}
